#!/usr/bin/python
# -*- encoding: utf-8 -*-
'''
@File    :   fight.py
@Time    :   2020/05/30 21:04:51
@Author  :   Malygos_l 
@Version :   1.0
@Contact :   751756061@qq.com
@WebSite :   www.gitee.com/malygos_l
'''
# Start typing your code from here
from human import human
from doge import doge
from random import randint

# 创建人和狗的对象
human_object = []
human_list = ["张三", "李四", "王五"]
for human_name in human_list:
    human_object.append(human(human_name))

doge_object = []
doge_list = ["柯基", "藏獒"]
for doge_name in doge_list:
    doge_object.append(doge(doge_name))

sign = randint(0, 1)
while (human_object != []) & (doge_object != []):
    if sign % 2 == 1:
        doge_index = randint(0, len(doge_object) - 1)
        doge_object[doge_index].attacked(human_object[randint(
            0,
            len(human_object) - 1)])
        if doge_object[doge_index].blood_volume <= 0:
            del doge_object[doge_index]

    else:
        human_index = randint(0, len(human_object) - 1)
        human_object[human_index].attacked(doge_object[randint(
            0,
            len(doge_object) - 1)])
        if human_object[human_index].blood_volume <= 0:
            del human_object[human_index]

    sign += 1

if len(doge_object) != 0:
    print("狗赢了")
elif len(human_object) != 0:
    print("人赢了")
else:
    print("打平了")